using System;
using System.Text.RegularExpressions;

namespace DynamicConfigurationManager.ConfigMapAttributes
{
    /// <summary>
    /// CurrentDirectoryRegEx compares the attribute value to the fully qualified path of the current directory.
    /// </summary>
    internal class CurrentDirectoryRegEx : IConfigMapAttribute
    {
        public bool Execute( string configMapAttribute )
        {
            LogHelper.Append( "CurrentDirectoryRegEx: matching to {0}", Environment.CurrentDirectory );
            var re = new Regex( configMapAttribute, RegexOptions.IgnoreCase );
            return re.IsMatch( Environment.CurrentDirectory );
        }
    }
}